FROM php:7.4.33-cli-alpine3.16

ENV COMPOSER_ALLOW_SUPERUSER 1

COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

COPY --from=ghcr.io/composer/docker /usr/bin/composer /usr/local/bin/

COPY ./docker/supervisor.conf /etc/supervisor-webman.conf

RUN set -e \
    # Install supervisor \
    && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
    && apk add --no-cache supervisor

RUN set -e \
    # Install extensions \
    && install-php-extensions pdo_mysql mongodb redis gd zip sockets pcntl posix event rdkafka msgpack bcmath gmp

WORKDIR /app

ENTRYPOINT ["supervisord", "-c", "/etc/supervisor-webman.conf"]